1. Field of Invention
The present invention relates to an image compression apparatus that compresses an image, particularly a picture image, and to a compression method and recording medium storing a computer readable compression program.
2. Description of Related Art
In recent years, there have been great advances in image compression technology to compress digital image compression signals. For example, compression methods such as the JPEG (Joint Photographic Experts Group) and the MPEG (Moving Picture Experts Group) methods are known, international standards for compressing digital still picture images and moving picture images.
These compression methods perform picture image compression by performing the following processes in the order: Discrete Cosine Transformation (DCT), followed by linear quantization, followed by variable-length coding.
Picture image compression first divides the picture image into blocks of, for example, 8×8 picture elements, and directly transforms each block of the picture image using DCT. The DCT separates the picture image signal into the portion that is necessary for viewing (that portion of the picture image having low frequency components), and into the portion that is not necessary for viewing (that portion of the picture image having high frequency components).
Next, quantization is performed by means of frequency weighted quantization. Frequency weighted quantization is a method that quantizes by changing the quantization amount in accordance with the frequency. Since the picture image data is transformed into frequency coefficients by the DCT, for example, the quantization amount is increased for the high frequency components that are not necessary for viewing, thereby reducing the data amount. The quantization amount is made smaller for the low frequency components that are necessary for viewing, thereby controlling the deterioration of the picture image.
Next, variable length code (VLC) such as, for example, Huffman encoding or so forth is applied. Huffman encoding, by assigning variable length code according to the frequency by which data is generated, encodes by assigning code with the shortest bit length to the data with the highest frequency of occurrence, thereby reducing the data amount.
With the picture image compression processing described above, the compression efficiency varies according to the amount of spatial redundancy of the particular picture image. In other words, a picture image having high spatial redundancy (for example, a natural picture image with low contrast) is appropriate for picture image compression because it can attain high compression efficiency. On the other hand, a picture image having little or no spatial redundancy (for example, computer graphics with high contrast) is not suitable for picture image compression because the compression efficiency (using JPEG or MPEG, for example) is low.
Depending upon the amount of this type of spatial redundancy, the post-compression file size varies greatly even when undergoing the compression process at the same compression level.
The electronic still camera is one primary example of a device that can suffer from this ill effect. The electronic still camera compresses a photographed picture image, input by means of a CCD, and records it in non-volatile memory. Normally, it is possible to compress and record several 10 s of photographic picture images (e.g., 20–60 images). However, when the post-compression file size varies greatly for each photographic picture image, it becomes impossible to know with certainty how many picture images can be recorded in a particular memory.
For this purpose, electronic still cameras have been proposed to unify and record the post-compression file size. With these cameras, a picture image undergoes compression processing so as to become a standard file size. For example, in the case of compressing a photographic picture image so as to have a unified file size of 100 KB, first, compression processing is performed at a certain compression level. If the compression result is larger than 100 KB, the compression level is raised and the compression process is repeated. If the compression result is smaller than 100 KB, then the compression level is lowered and the compression process is repeated.
By repeating the compression process by appropriately changing the compression level in this way, the photographic picture image is compressed to a standard file size. However, generally, since the file size of a photographic picture image is large, the computation time of compression processing is increased, creating a problem in that a long time is required until the photographic picture image can be compressed to the standard size.